// 需要在Vue.use(uvUI)之后执行
const primaryColor = '#fae358';

export const initUvConfig = () => {
  uni.$uv.setConfig({
    // 修改$uv.config对象的属性
    config: {
      // 修改默认单位为rpx，相当于执行 uni.$uv.config.unit = 'rpx'
      unit: 'rpx',
    },
    // 修改$uv.props对象的属性
    props: {
      // 修改组件参数的默认值，注意：默认值都要用default声明
      navbar: {
        leftIconSize: {
          default: 40,
        },
      },
      icon: {
        size: {
          default: 32,
        },
        labelSize: {
          default: 30,
        },
      },
      radio: {
        size: {
          default: 36,
        },
        iconSize: {
          default: 24,
        },
        labelSize: {
          default: 24,
        },
        activeColor: {
          default: primaryColor,
        },
      },
      checkbox: {
        size: {
          default: 36,
        },
        iconSize: {
          default: 24,
        },
        labelSize: {
          default: 24,
        },
        activeColor: {
          default: primaryColor,
        },
      },
      upload: {
        width: {
          default: 160,
        },
        height: {
          default: 160,
        },
      },
      input: {
        fontSize: {
          default: '30rpx',
        },
        inputHeight: {
          default: '48rpx',
        },
        inputLineHeight: {
          default: '48rpx',
        },
        prefixIconStyle: {
          default: 'font-size: 40rpx;',
        },
      },
      search: {
        height: {
          default: '80rpx',
        },
        searchIconSize: {
          default: 40,
        },
      },
      numberBox: {
        buttonSize: {
          default: '60rpx',
        },
        inputWidth: {
          default: '70rpx',
        },
      },
      formItem: {
        customStyle: {
          default: {
            padding: '20rpx 0',
          },
        },
      },
      datetimePicker: {
        itemHeight: {
          default: 88,
        },
        confirmColor: {
          default: primaryColor,
        },
      },
      noticeBar: {
        fontSize: {
          default: '28rpx',
        },
        iconSize: {
          default: 32,
        },
        customStyle: {
          default: {
            padding: '18rpx 24rpx',
          },
        },
      },
      picker: {
        itemHeight: {
          default: 88,
        },
        confirmColor: {
          default: primaryColor,
        },
      },
      tabs: {
        lineColor: {
          default: primaryColor,
        },

        activeStyle: {
          default: () => ({
            color: '#000',
          }),
        },
        inactiveStyle: {
          default: () => ({
            color: '#74858D',
          }),
        },
        itemStyle: {
          default: () => ({
            height: '92rpx',
          }),
        },
      },
      text: {
        default: '28rpx',
      },
      button: {
        fontSize: {
          default: '30rpx',
        },
        customStyle: {
          default: {
            padding: '18rpx 30rpx',
            height: '70rpx',
          },
        },
        loadingIconSize: {
          default: 24,
        },
        loadingTextSize: {
          default: 24,
        },
      },
    },
  });
};
